<?php 
add_action( 'admin_enqueue_scripts', 'import_epanel_javascript' );
function import_epanel_javascript( $hook_suffix ) {
	if ( 'admin.php' == $hook_suffix && 'wordpress' == $_GET['import'] && '1' == $_GET['step'] )
		add_action( 'admin_head', 'admin_headhook' );
}

function admin_headhook(){ ?>
	<script type="text/javascript">
		jQuery(document).ready(function($){
			$("p.submit").before("<p><input type='checkbox' id='importepanel' name='importepanel' value='1' style='margin-right: 5px;'><label for='importepanel'>Import epanel settings</label></p>");
		});
	</script>
<?php }

add_action('import_end','importend');
function importend(){
	if ( !isset($_POST['importepanel']) )
		return;
	
	$importOptions = 'YToxMDQ6e3M6MDoiIjtOO3M6MTA6IldlYmx5X2xvZ28iO3M6MDoiIjtzOjEzOiJXZWJseV9mYXZpY29uIjtzOjA6IiI7czoxODoiV2VibHlfY29sb3Jfc2NoZW1lIjtzOjc6IkRlZmF1bHQiO3M6MTY6IldlYmx5X2Jsb2dfc3R5bGUiO047czoxNjoiV2VibHlfZ3JhYl9pbWFnZSI7TjtzOjE4OiJXZWJseV9jYXRudW1fcG9zdHMiO3M6MToiNiI7czoyMjoiV2VibHlfYXJjaGl2ZW51bV9wb3N0cyI7czoxOiI1IjtzOjIxOiJXZWJseV9zZWFyY2hudW1fcG9zdHMiO3M6MToiNSI7czoxODoiV2VibHlfdGFnbnVtX3Bvc3RzIjtzOjE6IjUiO3M6MTc6IldlYmx5X2RhdGVfZm9ybWF0IjtzOjY6Ik0gaiwgWSI7czoxNzoiV2VibHlfdXNlX2V4Y2VycHQiO047czoxMzoiV2VibHlfYnV0dG9ucyI7czoyOiJvbiI7czoyMDoiV2VibHlfZGlzcGxheV9ibHVyYnMiO3M6Mjoib24iO3M6MTk6IldlYmx5X2Rpc3BsYXlfbWVkaWEiO3M6Mjoib24iO3M6MTg6IldlYmx5X2Zvb3Rlcl9xdW90ZSI7czoyOiJvbiI7czoyMzoiV2VibHlfZGlzcGxheV9sYW5kc2NhcGUiO3M6Mjoib24iO3M6MTg6IldlYmx5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M6MDoiIjtzOjIyOiJXZWJseV9pbnRlZ3JhdGlvbl9ib2R5IjtzOjA6IiI7czoyODoiV2VibHlfaW50ZWdyYXRpb25fc2luZ2xlX3RvcCI7czowOiIiO3M6MzE6IldlYmx5X2ludGVncmF0aW9uX3NpbmdsZV9ib3R0b20iO3M6MDoiIjtzOjE2OiJXZWJseV80NjhfZW5hYmxlIjtOO3M6MTU6IldlYmx5XzQ2OF9pbWFnZSI7czowOiIiO3M6MTM6IldlYmx5XzQ2OF91cmwiO3M6MDoiIjtzOjE3OiJXZWJseV80NjhfYWRzZW5zZSI7czowOiIiO30';
	
	global $options;
	
	foreach ($options as $value) {
		if( isset( $value['id'] ) ) { 
			update_option( $value['id'], $value['std'] );
		}
	}
	
	$importedOptions = unserialize(base64_decode($importOptions));
	
	foreach ($importedOptions as $key=>$value) {
		if ($value != '') update_option( $key, $value );
	}
} ?>